package com.tianji.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

@Configuration
public class MyThreadExecutors {
    @Bean
    public Executor wscDaHaoRenExecutor() {
        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
        threadPoolTaskExecutor.setCorePoolSize(8);
        threadPoolTaskExecutor.setMaxPoolSize(16);
        threadPoolTaskExecutor.setKeepAliveSeconds(30);
        threadPoolTaskExecutor.setQueueCapacity(60);
        threadPoolTaskExecutor.setThreadNamePrefix("WSC-DahaoRen-");
        threadPoolTaskExecutor.initialize();
        return threadPoolTaskExecutor;
    }
}
